package com.example.juyixia;


import android.os.Bundle;

import java.util.List;

import com.hp.hpl.sparta.Text;

import android.app.Fragment;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;


public class Set_Fragment extends Fragment{
	private TextView username;
	private TextView userid;
	private Myinfo myinfo;
	private RelativeLayout my_position;
	private RelativeLayout re_setting;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
//		View rootView = inflater.inflate(R.layout.fragment_04, container,false);
//
//		username = (TextView)rootView.findViewById(R.id.tv_name);
//		userid = (TextView) rootView.findViewById(R.id.tv_fxid);
//		
//		myinfo=(Myinfo) getActivity().getApplication();
//
//		username.setText("lihao");
//		userid.setText("123");
		View view = inflater.inflate(R.layout.fragment_04, container, false);

		return view;
	}
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
		myinfo=(Myinfo) getActivity().getApplication();
		username = (TextView)getActivity().findViewById(R.id.tv_name);
		userid = (TextView)getActivity().findViewById(R.id.tv_fxid);
		username.setText(myinfo.getUsername().toString());
		userid.setText("账号："+myinfo.getUserid().toString());
		my_position = (RelativeLayout) getActivity().findViewById(R.id.my_position);
		my_position.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				my_position = (RelativeLayout) getActivity().findViewById(R.id.my_position);
				Intent intent = new Intent(getActivity(), Map_Activity.class);
				//从我的位置进入地图
				String message = "我的位置";
				intent.putExtra("message",message);
				//判断用户
				String uid = myinfo.getUserid();
				intent.putExtra("id", uid);
				startActivity(intent);
			}
		});
		re_setting = (RelativeLayout) getActivity().findViewById(R.id.re_setting);
		re_setting.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				re_setting = (RelativeLayout) getActivity().findViewById(R.id.re_setting);
				Intent intent = new Intent(getActivity(), SetActivity.class);
				startActivity(intent);
			}
		});
	}
}
